package com.sqtracker.recommender.model;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import java.util.Date;

@Data
@Document(collection = "user_behaviors")
public class UserBehavior {
    @Id
    private String id;
    private String userId;
    private String torrentId;
    private String type;  // VIEW, LIKE, DOWNLOAD, RATE, REPORT
    private Integer rating;  // 1-5，仅当type为RATE时
    private Date timestamp;
    private Integer duration;  // 停留时间(秒)，仅适用于VIEW
    private BehaviorContext context;

    @Data
    public static class BehaviorContext {
        private String referrer;  // 来源页面
        private String query;     // 搜索查询
        private String device;    // 设备类型
    }
}